# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=libucontext
pkgver=1.2
pkgrel=3
pkgdesc="ucontext function implementations"
url="https://github.com/kaniini/libucontext"
arch="all"
license="ISC"
subpackages="$pkgname-dev $pkgname-doc"
makedepends="scdoc"
source="https://distfiles.ariadne.space/libucontext/libucontext-$pkgver.tar.xz
	0001-common-trampoline-Ensure-omission-of-frame-pointer.patch"

case "$CTARGET_ARCH" in
	arm*)		LIBUCONTEXT_ARCH="arm" ;;
	ppc64le)	LIBUCONTEXT_ARCH="ppc64" ;;
	*)		LIBUCONTEXT_ARCH="$CTARGET_ARCH" ;;
esac

build() {
	make ARCH="$LIBUCONTEXT_ARCH"
	make ARCH="$LIBUCONTEXT_ARCH" docs
}

check() {
	make ARCH="$LIBUCONTEXT_ARCH" check
}

package() {
	make ARCH="$LIBUCONTEXT_ARCH" DESTDIR="$pkgdir" install install_docs
}

sha512sums="
6603f2dcd87c4d9919c1726f2964632483e1a647733ff543d5935e3e2dac548adf320f1f9fb4c494691fe99fb393d64b15369f04d3783b2ca4c40b68c3d87865  libucontext-1.2.tar.xz
4e797976943dcc98dbc2541a17e517da1b95ed50e0c730c547ccc604e682d1150e90c6bb29f601549b6a0bf4b7228e7a7d9883e97ea6bff4d12956df6b9a1195  0001-common-trampoline-Ensure-omission-of-frame-pointer.patch
"
